package com.utn.tp.integrador.conexion;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class InfoConexion {

	private Context context;

	protected InfoConexion(Context context) {
		this.context = context;
	}

	public boolean hayConexionAInternetDisponible() {
		ConnectivityManager connectivity;
		NetworkInfo wifiInfo;
		NetworkInfo mobileInfo;
		connectivity = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		wifiInfo = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
		mobileInfo = connectivity
				.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
		return (wifiInfo.isConnected() || mobileInfo.isConnected());
	}
}
